package day15_129;

/**
 * @ClassName Solution
 * @Description TODO
 * @Author clockTown
 * @Date 2021/5/24 20:44
 * @Version 1.0
 */
public class Solution {
    public int sumNumbers(TreeNode root) {
        if (root == null) {
            return 0;
        }
        if (root.left == null && root.right == null) {
            return root.val;
        }

        int left = sumNumbers(root.left) * 10;
        int right = sumNumbers(root.right) * 10;
        double res1 = Math.pow(10, (int) Math.log10(left)) * root.val;
        double res2 = Math.pow(10, (int) Math.log10(right)) * root.val;

        return (int)(res1 + res2);
    }


    public static void main(String[] args) {
        System.out.println(Math.log10(195));
    }
}
